package com.yanqu.road.entity.rank.cross;

import com.alibaba.fastjson.JSON;
import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.player.UserBaseInfo;

public class CrossUserDecoration extends DataObject {

    private int decorationId;                     //排行榜类型

    private long userId;                          //玩家Id

    private UserBaseInfo userBaseInfo = new UserBaseInfo();

    private long endTime;                         //到期时间

    private long modifyTime;                      //变更时间

    public int getDecorationId() {
        return decorationId;
    }

    public void setDecorationId(int decorationId) {
        if(this.decorationId != decorationId) {
            this.decorationId = decorationId;
            setUpdateOption();
        }
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if(this.userId != userId) {
            this.userId = userId;
            setUpdateOption();
        }
    }

    public UserBaseInfo getUserBaseInfo() {
        return userBaseInfo;
    }

    public String getUserBaseInfoJsonStr(){
        if(null == userBaseInfo){
            return "{}";
        }else {
            return JSON.toJSONString(userBaseInfo);
        }
    }

    public void setUserBaseInfo(UserBaseInfo userBaseInfo) {
        this.userBaseInfo = userBaseInfo;
        setUpdateOption();
    }

    public long getEndTime() {
        return endTime;
    }

    public void setEndTime(long endTime) {
        if(this.endTime != endTime) {
            this.endTime = endTime;
            setUpdateOption();
        }
    }

    public long getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(long modifyTime) {
        if(this.modifyTime != modifyTime) {
            this.modifyTime = modifyTime;
            setUpdateOption();
        }
    }

    public CrossUserDecoration clone(){
        CrossUserDecoration data = new CrossUserDecoration();
        data.setDecorationId(decorationId);
        data.setUserId(userId);
        data.setUserBaseInfo(userBaseInfo);
        data.setEndTime(endTime);
        data.setModifyTime(modifyTime);
        return data;
    }
}
